python readlines without n

56

python readlines without n -

temp = file.read().splitlines()

python read file without newline -

# converts read file into a list without newlines
temp = file.read().splitlines()

python readlines \n -

with open('filename.txt') as f:
    alist = [line.rstrip() for line in f]

Comments

Submit
0 Comments